<%@ page import="com.itxx.bean.Student" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.HashMap" %><%--
  Created by IntelliJ IDEA.
  User: lenovo
  Date: 2020/11/1
  Time: 18:33
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>EL表达式</title>
</head>
<body>
<%--1.获取基本数据类型--%>
<% pageContext.getRequest().setAttribute("num",10); %>
基本数据类型:${num}<br>
<hr>

<%--2.获取自定义对象类型--%>
<%
    Student stu = new Student("李思思",20);
    pageContext.setAttribute("stu",stu);
%>
自定义数据类型:${stu.name}<br>
自定义数据类型:${stu.age}<br>
<hr>

<%--4.获取List集合--%>
<%
    ArrayList<Object> list = new ArrayList<>();
    list.add("abc");
    list.add("ADC");
    pageContext.setAttribute("list",list);
%>
ArrayList集合中:${list[0]}<br>
ArrayList集合中:${list[1]}<br>
<hr>

<%--5.获取Map集合--%>
<%
    HashMap<String, String> map = new HashMap<>();
    map.put("陕西","西安");
    map.put("中国","北京");
    map.put("四川","成都");
pageContext.setAttribute("map",map);
%>
map集合中:${map['陕西']}<br>
map集合中:${map.中国}<br>
map集合中:${map['四川']}<br>

</body>
</html>
